0. Important

This agent was created by SunlitMiracle. Feel free to distribute this anywhere or to make any edits, as long as credit for the original agent is given.

Thanks to Vermidia for giving advice when I got stuck on some of the code.

The following info likely won't matter to a casual user unless they need very specific values for some reason, but it's offered for transparency:

Chance-based fields are displayed (and accepts inputs in) percentages even though the actual value used in the game is a floating-point number. For example, typing in 50 will result in 0.50 being used as the variable. For readability reasons this agent converts between integers and floats, so trying to enter 33.3% will result in 0.33, and if you change the value to 0.3333 before installing the agent it will still display as 33%, and clicking on it may alter the actual value to 0.33. The % symbol will cut off any digits that happen to be following it, so make sure to delete it when making an input.

Also, due to a quirk in how calculations are done, 1.0 does not result in guaranteed chances, but anything higher does. So entering 100% will instead input 1.1 into the variable. Injecting/reinjecting the agent while the variables have already been changed in some way may lead to displays not normally allowed by the agent (ex. 1.2345 will appear as 123%), but the values will be normalized as soon as a text entry field is clicked.

1. Description

Pregnancy Values is a GUI agent that allows easier access to certain game variables, specifically the ones tied to the extra egg limit and to multiple births. Normally the user would have to either change these variables on the CAOS Command Line or (for new worlds only) in the !DS_game variables.cos file. Now they are accessible as the Breeding and Population Limits on the options menu.

2. Usage

When injected the agent will display a floating window that can be right-clicked to move. Five text-entry slots will be displayed and pre-filled with whatever the current values of the variables are, converted into integers and percentages if necessary. Once injected these fields will NOT update if the values are changed by external means such as the command line, and clicking on the agent may cause its values to overwrite your external input. If you want to make any external inputs, it's advised to un-inject the agent once you're done using it.

The sections are briefly described in the catalogue help file, and are as follows:

2.a. Extra Eggs Allowed

The number of eggs over the Breeding Limit that your creatures are allowed to produce. Have you ever tried setting the Breeding Limit to 0 to stop all breeding in the world, just for your Norns to pop out several dozen eggs anyway? Thank Extra Eggs Allowed for that!

There are situations where eggs can still go over the combined limit of the Breeding Limit and Extra Eggs, specifically due to multiple creatures getting pregnant at the same time and creatures being pregnant with multiples. I don't know how this would interact with any sort of live birth mod, either.

2.b. Multiple Birth First Chance

The first check for if a pregnancy can have more than one embryo. By itself, this will add only one embryo, giving you twins.

2.c. Multiple Birth Subsequent Chance

Subsequent checks to add additional embryos, up to whatever is set as the maximum. The first check must pass or else this value will do nothing.

2.d. Multiple Birth Maximum

The maximum amount of embryos allowed in a single pregnancy. As far as I can tell setting it to 0 or a negative number does not prevent pregnancies, but setting it to 1 prevents multiples and 2 prevents triplets/etc.. This hasn't been thoroughly tested, so if you're trying to limit children you might want to use other settings in tandem with this.

This agent caps the maximum at 50 for the safety for your game. In my stress tests I set this value 70000 and set the multiples odds at 1.1, resulting in over an hour of generating genome files and a game that never recovered from the freeze caused by said generation. This is still not nearly close to the actual limit, which is 2,147,483,647 (putting in anything higher causes it to overflow into negatives). Suffice to say, I don't want to be responsible someone generating two billion files on their computer.

While I do think users should have freedom to mess around in their own games even if it causes major issues, I'm also taking into account the possibility of an unnoticed typo, such as someone inputting 200 instead of 20, while also happening to have maximum odds for multiples. Even with just three digits you risk freezes and agent errors, and that's before getting into the likelihood your poor birth-giver won't live long enough to lay all those eggs naturally. Even on my decent desktop computer, generating 200 genomes or 100 eggs causes the game to stutter for a few seconds; on my laptop with a terribly outdated processor, it can take several minutes to generate all those genomes and notifications.

For these reasons I've decided on 50 as the limit I'm comfortable with. If you insist on a higher number, you can still input it via the CAOS Command Line via the command "setv game "engine_multiple_birth_maximum" X" with X being your desired number. Just don't click on any text entries on the agent afterwards, or else the number will be brought down to 50 and you'll have to manually change it again.

2.e. Multiple Birth Identical Chance

Chance that multiples will have identical genomes. This is all-or-nothing: A litter of 10 will either all be identical or all be different. This does not influence sex or variants, so assuming that no other agent changes these aspects of eggs* you may still hatch very different creatures based on genes being switched on/off. For example, if a genome has a mutation that makes initial concentrations exist only for one variant, you'd end up with mostly stillbirths and few survivors.

(* I have seen some agents that extract eggs from pregnant creatures but don't correctly randomize the gender or variant for each egg. This could cause true identicals to hatch.)